<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
    </style>
</head>

<body id='body'>

    <script>
        function randomColor() {
            return 'rgb(' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ')'
        }
        console.log(randomColor())
        document.getElementById('body').style.background = randColor()



        //----------------------------------------------------------------------
        function randColor() {
            var str = "#"
            for (var i = 0; i < 6; i++) {
                str += (Math.round(Math.random() * 16)).toString(16)
            }
            return str;
        }
        console.log(randColor())
    </script>
</body>

</html>